<template>
  <div>
    <div class="page-wrap clearBoth">
      <slot name="search">

      </slot>
      <pagination
        :small="true"
        :currentPage="pagination.currentPage"
        :count="pagination.count"
        @turnPage="turnPage"
        class="fr"
        :pageSize="limit"
        :totalPage="totalPage"
      >
      </pagination>
    </div>
    <slot name="table"></slot>
  </div>
</template>
<script>
  import pagination from '@/components/public-modules/card/Pagination'
  export default {
    name: 'commonTable', // 真翻页
    data () {
      return {
      }
    },
    props: {
      pagination: Object,
      limit: {type: Number, default: 10}
    },
    components: {
      pagination
    },
    computed: {
      totalPage () {
        return Math.ceil(this.pagination.count / this.limit) || 0
      }
    },
    methods: {
      turnPage (val) {
        this.$emit('turnPage', val)
      }
    },
    beforeMount () {
    }
  }
</script>
<style lang="stylus" scoped>
  @import '../../../../../assets/common.styl'
  .page-wrap
    padding 5px 15px 5px 0
    border 1px solid $c-border1
    border-bottom none
  .size-select
    margin-top 6px
    width 100px
</style>
